package com.yx.elastic.elasticcm.base;

/**
 * Created by chenzp on 18-8-1.
 */
public class ISearchException extends Exception {

    private int errorCode;

    private ISearchExceptionCode code;

    public ISearchException(int errorCode) {
        super(ISearchExceptionCode.getNameByCode(errorCode));
        this.errorCode = errorCode;
    }


    public ISearchException(ISearchExceptionCode code) {
        super(code.getMessage());
        this.errorCode = code.getCode();
    }



    public ISearchException(String message, ISearchExceptionCode code) {
        super(code.getMessage()+" "+message);
        this.errorCode = errorCode;
    }

    public ISearchException(String message, int errorCode) {
        super(ISearchExceptionCode.getNameByCode(errorCode)+" "+message);
        this.errorCode = errorCode;
    }

    public ISearchException(String message, Throwable throwable, int errorCode) {
        super(ISearchExceptionCode.getNameByCode(errorCode)+" "+message, throwable);
        this.errorCode = errorCode;
    }

    public ISearchException(Throwable throwable, int errorCode) {
        super(throwable);
        this.errorCode = errorCode;
    }

    public ISearchException(String message, Throwable throwable, boolean b, boolean b1, int errorCode) {
        super(ISearchExceptionCode.getNameByCode(errorCode)+" "+message, throwable, b, b1);
        this.errorCode = errorCode;
    }

    public int getErrorCode() {
        return errorCode;
    }
}
